package controls {
	
	import mx.containers.VBox;
	import mx.controls.ProgressBar;
	import mx.controls.ProgressBarMode;
	import mx.events.FlexEvent;
	/**
	 * @author Brent Kersanske
	 */ 
	public class LoadingControlClass extends VBox {
		
		private var _loadingLabelText:String;
		
		[Bindable]
		public var progressBar:ProgressBar;
		
		public function LoadingControlClass(){
			addEventListener(FlexEvent.CREATION_COMPLETE, handleCreationComplete);
		}
		
		private function handleCreationComplete(e:FlexEvent):void {
			
		}
		
		[Bindable]
		public function set loadingLabelText(labelText:String):void {
			_loadingLabelText = labelText;
		}
		
		public function get loadingLabelText():String {
			return _loadingLabelText;
		}
		
		public function signalFailure(failureMessage:String):void {
			this.progressBar.indeterminate = false;
			this.progressBar.setProgress(0, 100);
			this.loadingLabelText = failureMessage;
		}

		public function signalCompletion(completionMessage:String):void {
			this.progressBar.indeterminate = false;
			this.progressBar.setProgress(100, 100);
			this.loadingLabelText = completionMessage;
		}

	}
}